package tpdisenio2009.model.beans;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author Nicolás Kreiff
 */
@Entity
public class FantasyTeamScoreByTournamentDate implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    @JoinColumn(name = "id_fantasy_team", referencedColumnName = "id", nullable=false)
    @ManyToOne(optional = false)
    private FantasyTeam fantasyTeam;

    @JoinColumn(name = "id_tournament_date", referencedColumnName = "id", nullable=false)
    @ManyToOne(optional = false)
    private TournamentDate tournamentDate;

    @Column(name="score", nullable=false)
    private int score;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public FantasyTeam getFantasyTeam() {
        return fantasyTeam;
    }

    public void setFantasyTeam(FantasyTeam fantasyTeam) {
        this.fantasyTeam = fantasyTeam;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public TournamentDate getTournamentDate() {
        return tournamentDate;
    }

    public void setTournamentDate(TournamentDate tournamentDate) {
        this.tournamentDate = tournamentDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) id;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FantasyTeamScoreByTournamentDate)) {
            return false;
        }
        FantasyTeamScoreByTournamentDate other = (FantasyTeamScoreByTournamentDate) object;
        if (this.id != other.id) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tpdisenio2009.model.beans.FantasyTeamScoreByTournamentDate[id=" + id + "]";
    }

}
